package com.southwind.mapper;

import com.southwind.entity.BusCheck;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2024-05-28
 */
public interface BusCheckMapper extends BaseMapper<BusCheck> {

    @Select({"select COALESCE(sum(paymoney+price),0) from bus_rent,bus_check where\n" +
            "\t\tDATE_FORMAT(bus_rent.createtime,'%m') = 1\n" +
            "\t\tUNION all\n" +
            "\t\tselect\n" +
            "\t\tCOALESCE(sum(paymoney+price),0) from bus_rent,bus_check where\n" +
            "\t\tDATE_FORMAT(bus_rent.createtime,'%m') = 2\n" +
            "\t\tUNION all\n" +
            "\t\tselect\n" +
            "\t\tCOALESCE(sum(paymoney+price),0) from bus_rent,bus_check where\n" +
            "\t\tDATE_FORMAT(bus_rent.createtime,'%m') = 3\n" +
            "\t\tUNION all\n" +
            "\t\tselect\n" +
            "\t\tCOALESCE(sum(paymoney+price),0) from bus_rent,bus_check where\n" +
            "\t\tDATE_FORMAT(bus_rent.createtime,'%m') = 4\n" +
            "\t\tUNION all\n" +
            "\t\tselect\n" +
            "\t\tCOALESCE(sum(paymoney+price),0) from bus_rent,bus_check where\n" +
            "\t\tDATE_FORMAT(bus_rent.createtime,'%m') = 5\n" +
            "\t\tUNION all\n" +
            "\t\tselect\n" +
            "\t\tCOALESCE(sum(paymoney+price),0) from bus_rent,bus_check where\n" +
            "\t\tDATE_FORMAT(bus_rent.createtime,'%m') = 6\n" +
            "\t\tUNION all\n" +
            "\t\tselect\n" +
            "\t\tCOALESCE(sum(paymoney+price),0) from bus_rent,bus_check where\n" +
            "\t\tDATE_FORMAT(bus_rent.createtime,'%m') = 7\n" +
            "\t\tUNION all\n" +
            "\t\tselect\n" +
            "\t\tCOALESCE(sum(paymoney+price),0) from bus_rent,bus_check where\n" +
            "\t\tDATE_FORMAT(bus_rent.createtime,'%m') = 8\n" +
            "\t\tUNION all\n" +
            "\t\tselect\n" +
            "\t\tCOALESCE(sum(paymoney+price),0) from bus_rent,bus_check where\n" +
            "\t\tDATE_FORMAT(bus_rent.createtime,'%m') = 9\n" +
            "\t\tUNION all\n" +
            "\t\tselect\n" +
            "\t\tCOALESCE(sum(paymoney+price),0) from bus_rent,bus_check where\n" +
            "\t\tDATE_FORMAT(bus_rent.createtime,'%m') = 10\n" +
            "\t\tUNION all\n" +
            "\t\tselect\n" +
            "\t\tCOALESCE(sum(paymoney+price),0) from bus_rent,bus_check where\n" +
            "\t\tDATE_FORMAT(bus_rent.createtime,'%m') = 11\n" +
            "\t\tUNION all\n" +
            "\t\tselect\n" +
            "\t\tCOALESCE(sum(paymoney+price),0) from bus_rent,bus_check where\n" +
            "\t\tDATE_FORMAT(bus_rent.createtime,'%m') = 12"})
    public List<Integer> companyYearGradeStat();

}
